package com.ruoyi.web.controller.mall.cmsNoticeSys.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.web.controller.mall.cmsNoticeSys.domain.CmsNoticeSys;
import com.ruoyi.web.controller.mall.cmsNoticeSys.service.ICmsNoticeSysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 系统公告Controller
 * 
 * @author ruoyi
 * @date 2021-01-18
 */
@RestController
@RequestMapping("/mall/cmsNoticeSys")
public class CmsNoticeSysController extends BaseController
{
    @Autowired
    private ICmsNoticeSysService cmsNoticeSysService;

    /**
     * 查询系统公告列表
     */
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody CmsNoticeSys cmsNoticeSys)
    {
        CmsNoticeSys cns = new CmsNoticeSys();
        startPage();
        List<CmsNoticeSys> list = cmsNoticeSysService.selectCmsNoticeSysList(cns);
        return getDataTable(list);
    }

    /**
     * 获取系统公告详细信息
     */
//    @PreAuthorize("@ss.hasPermi('system:notice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(cmsNoticeSysService.selectCmsNoticeSysById(id));
    }
    /**
     * 新增保存系统公告
     */
//    @Log(title = "系统公告", businessType = BusinessType.INSERT)
//    @PostMapping("/add")
//    @ResponseBody
//    public AjaxResult addSave(CmsNoticeSys cmsNoticeSys)
//    {
//        return toAjax(cmsNoticeSysService.insertCmsNoticeSys(cmsNoticeSys));
//    }

    /**
     * 修改保存系统公告
     */
//    @RequiresPermissions("mall:cmsNoticeSys:edit")
//    @Log(title = "系统公告", businessType = BusinessType.UPDATE)
//    @PostMapping("/edit")
//    @ResponseBody
//    public AjaxResult editSave(CmsNoticeSys cmsNoticeSys)
//    {
//        return toAjax(cmsNoticeSysService.updateCmsNoticeSys(cmsNoticeSys));
//    }

    /**
     * 删除系统公告
     */
//    @RequiresPermissions("mall:cmsNoticeSys:remove")
//    @Log(title = "系统公告", businessType = BusinessType.DELETE)
//    @PostMapping( "/remove")
//    @ResponseBody
//    public AjaxResult remove(String[] ids)
//    {
//        return toAjax(cmsNoticeSysService.deleteCmsNoticeSysByIds(ids));
//    }
}
